﻿using System;

namespace EmbeddedSharp.Core.Function.Trigonometry {
    public class SinNode : FuncNode {
        public SinNode()
            : base("sin") {
        }

        public override FuncNode GetReversedFunction(int index) {
            return new AsinNode();
        }

        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new ArgumentException(
                    "usage: sin(number)");
            }

            double[] results = EvaluateChildren();

            return System.Math.Sin(results[0]).ToString();
        }
    }
}
